<!--
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2022-12-19 16:14:15
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-10-09 16:45:06
 * @FilePath: \cxl-admin\src\components\dict\Index.vue
-->
<template>
    <el-tag :type="data.type" v-if="data.value">{{ data.value }}</el-tag>
</template>
<script setup lang="ts">
import { reactive, watchEffect } from 'vue'
const data = reactive({ type: '', value: '' })
//接收父级传递的参数
const props = defineProps(['data', 'value'])
//监听参数变化
watchEffect(() => {
    props.data.forEach((element: any) => {
        if (element.value === props.value) {
            data.value = element.label
            data.type = element.type
        }
    })
})
</script>
